package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.DishPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;


@Mapper
public interface DishMapper {

    //新增菜品,并返回主键id
    @AutoFill(OperationType.INSERT)
    public void insertDish(Dish dish);

    //分页
    Page<Dish> page(DishPageQueryDTO dishPageQueryDTO);

    //根据菜品id查询
    @Select("select * from dish where id=#{id}")
    Dish getById(Long id);

    //根据id集合删除菜品
    public int deleteDish(List<Long> dishIds);

    //修改菜品信息
    void updateDish(Dish dish);

    //根据分类id查询菜品
    List<Dish> getDishBycategoryId(Dish dish);


    List<Dish> list(Dish dish);

    /**
     * 根据条件统计菜品数量
     * @param map
     * @return
     */
    Integer countByMap(Map map);
}
